let debounce=function(fn,wait){
   let  timer=null
   let first=true
    return function(){
        if(first){fn();first=false}
        if(timer){
            clearTimeout(timer)
        }
       timer=setTimeout(fn,wait)
    }
}
document.onclick=debounce(()=>{console.log(this)},1000)
